﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Web.admin.news
{
    /// <summary>
    /// SingleDelete 的摘要说明
    /// </summary>
    public class SingleDelete : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/Html";
            if (context.Request.QueryString["id"] != null) {
                int i = SingleDel(context.Request.QueryString["id"]);
                if (i > 0)
                {
                    context.Response.Write("<script>alert('删除成功');window.location.href='list.aspx'</script> ");
                }
                else {
                    context.Response.Write("<script>alert('删除失败');window.location.href='list.aspx'</script>");
                }
                
            }
            
        }
        public bool IsReusable
        {
            get { return true; }
        }

        /// <summary>
        /// 根据id对一行数据进行删除
        /// </summary>
        /// <param name="id">id号</param>
        /// <returns>返回删除的行数</returns>
        protected int SingleDel(string id) {
            int i = new BLL.NewsContent().DelData(id);
            return i;
        }
    }
}